#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include "game.hpp"
#include "net_connection.hpp"
#include "ClientPlayer.hpp"

extern const bool multiplayer;

int main(void)
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Test Fighter");
    App.UseVerticalSync(true);
    App.SetFramerateLimit(120);

    sf::Vector2f Center(400,300);
    sf::Vector2f HalfSize(400, 300);
    sf::View View(Center, HalfSize);

	sf::Shape Fighter;
	Fighter.AddPoint(-5, 0, sf::Color(255, 0, 255));
	Fighter.AddPoint(55, 0, sf::Color(255, 0, 255));
	Fighter.AddPoint(50, 50, sf::Color(255, 0, 255));
	Fighter.AddPoint(0, 50, sf::Color(255, 0, 255));
	Fighter.SetPosition(200.f,200.f);
	Fighter.SetCenter(25,25);
	Fighter.EnableFill(true);

    Net_Connection conn;

    if(multiplayer)
    {
        conn.connect(sf::IPAddress("127.0.0.1"),4567);
    }

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
        moveship(App,Fighter,conn);
    }
    return 0;
}
